import request from '@/utils/request'

export function getCategories(params) {
  return request({
    url: `/categories`,
    params
  })
}

export function getCategoriesCount(params) {
  return request({
    url: `/categories/count`,
    params
  })
}

export function delCategory(id) {
  return request({
    url: `/categories/${id}`,
    method: 'delete'
  })
}

export function addCategory(data) {
  return request({
    url: `/categories`,
    method: 'post',
    data
  })
}

export function getCategoryDetail(id) {
  return request({
    url: `/categories/${id}`
  })
}

export function updateCategory(data) {
  return request({
    url: `/categories/${data.id}`,
    method: 'put',
    data
  })
}
